package red.action;

import com.opensymphony.xwork2.Action;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import red.mapper.Usermapper;
import red.model.ResModel;
import red.model.UserModel;
import red.service.UserService;
import red.service.impl.UserServiceImpl;
import red.util.BaseAction;
import red.util.Model;
import red.util.SqlSessionFactoryUtils;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@SuppressWarnings("ALL")
public class UserAction  extends BaseAction {
    @Autowired
    private  UserServiceImpl userService;
    private UserModel userModel;
    private List<UserModel> userModels;
    private List list;
    private ResModel resModel;

    public List getList() {
        return list;
    }

    public void setList(List list) {
        this.list = list;
    }

    public ResModel getResModel() {
        return resModel;
    }
    public UserModel getUserModel() {
        return userModel;
    }

    public void setUserModel(UserModel userModel) {
        this.userModel = userModel;
    }

    public List<UserModel> getUserModels() {
        return userModels;
    }

    public void setUserModels(List<UserModel> userModels) {
        this.userModels = userModels;
    }
    public String selectuser(){
        Model model = getParams();
        userModels = userService.selectuser(model);
        return Action.SUCCESS;
    }
    public String login(){
        Model model = getParams();
        userModels = userService.login(model);
        return Action.SUCCESS;
    }
    public String reigst() {
        Model model = getParams();
        list = userService.registuser(model);
        return Action.SUCCESS;
    }

}
